package org.jeecg.modules.crm.service.impl;

import org.jeecg.modules.crm.entity.SalesInfo;
import org.jeecg.modules.crm.entity.SalesPurchaserTenant;
import org.jeecg.modules.crm.mapper.SalesPurchaserTenantMapper;
import org.jeecg.modules.crm.mapper.SalesInfoMapper;
import org.jeecg.modules.crm.service.ISalesInfoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: Sales
 * @Author: jeecg-boot
 * @Date:   2025-04-28
 * @Version: V1.0
 */
@Service
public class SalesInfoServiceImpl extends ServiceImpl<SalesInfoMapper, SalesInfo> implements ISalesInfoService {

	@Autowired
	private SalesInfoMapper salesInfoMapper;
	@Autowired
	private SalesPurchaserTenantMapper salesPurchaserTenantMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		salesPurchaserTenantMapper.deleteByMainId(id);
		salesInfoMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			salesPurchaserTenantMapper.deleteByMainId(id.toString());
			salesInfoMapper.deleteById(id);
		}
	}
	
}
